package com.zhaojp.demo.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * ClassName:MyListener
 * @since    JDK 1.8
 */

@WebListener
public class MyListener implements ServletContextListener{
//    public class MyListener extends ContextLoaderListener {

    private static Logger logger = LoggerFactory.getLogger(MyListener.class);

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        logger.info("--my-监听器-ServletContext 初始化");
        logger.info(sce.getServletContext().getServerInfo());
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        logger.info("--my-监听器-ServletContext 销毁");
    }
}
